package com.njtoyo.taxi.admin.library.common;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

public abstract class MapHelper {

    public static <T> List<T> convertList(Object input,Class<T> clazz){
        List<?> list = (List<?>) input;
        if(CollUtil.isEmpty(list)) return new ArrayList<>();
        return list.stream().map(it -> Convert.convert(clazz,it)).collect(Collectors.toList());
    }

    public static List<Long> convertList(Object input){
       return convertList(input,Long.class);
    }

}
